/*
 * @User 		@Company 	@Date
 * marcusbui	VNNET24  	Jun 19, 2011
 */
package tsb.com.html5.controller.common;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import tsb.com.html5.comment.service.ICommentService;
import tsb.com.html5.controller.base.BaseController;
import tsb.com.html5.product.service.IProductService;
import tsb.com.html5.user.service.IUserService;

// TODO: Auto-generated Javadoc
/**
 * The Class HomeController.
 */
@Controller
@RequestMapping("/home")
public class HomeController extends BaseController{

	/** The product service. */
	@Resource(name="ProductService")
	private IProductService productService;
	
	/** The comment service. */
	@Resource(name="CommentService")
	private ICommentService commentService;
	
	/** The user service. */
	@Resource(name="UserService")
	private IUserService userService;
	
	/**
	 * Handle.
	 *
	 * @param request the request
	 * @param response the response
	 * @return the model and view
	 * @throws Exception the exception
	 */
	@RequestMapping(method = RequestMethod.GET)
	protected ModelAndView handle(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView model = new ModelAndView("home");
		try {
			
			/*List<ProductItem> productList = productService.getProduct(new GetProductParam());
			model.addObject("ProductList",productList);
			
			List<CommentItem> commentList = commentService.getComment(new GetCommentParam());
			model.addObject("CommentList",commentList);
			
			request.getSession().setAttribute("ProductList", productList);
			this.getServletContext().getAttribute("thong");
			List<UserItem> userList = userService.selectUserInfo(new GetUserParam());
			System.out.print(userList.size());
			
			List<CategoryItem> listTest = this.cacheController.getCategory();
			System.out.print(listTest.size());*/
			
		} catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
		return model;
	}
}
